/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package session04;

/**
 *
 * @author macbookpro
 */
public class Student implements Comparable {

    private String rollNo;
    private String name;

    public Student() {
        this.rollNo = "";
        this.name = "no name";
    }

    public Student(String rollNo, String name) {
        this.rollNo = rollNo;
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getRollNo() {
        return rollNo;
    }

    public void setRollNo(String rollNo) {
        this.rollNo = rollNo;
    }

    public String toString() {
        return this.rollNo + " - " + this.name;
    }

    @Override
    public int compareTo(Object t) {
        if (!(t instanceof Student)) {
            throw new UnsupportedOperationException("Not supported yet.");
        }

        return this.rollNo.compareTo(((Student) t).rollNo);
    }
}
